package ssm.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import ssm.entity.book;
import ssm.entity.type;
import ssm.mapper.BookMapper;
import ssm.mapper.TypeMapper;
import ssm.service.BookService;

import java.util.List;
@Service
public class BookServiceImpl implements BookService {
    @Autowired
    private BookMapper bookMapper;
    @Autowired
    private TypeMapper typeMapper;
    @Override
    public PageInfo<book> findAll(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<book> list=bookMapper.findAll();
        PageInfo<book> pageInfo=new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public List<type> findAlltypes() {
        List<type> types=typeMapper.findAll();
        return types;
    }
}
